#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int n = 0;
	scanf("%d", &n);
	int arr[10][10] = { 0 };
	int ret = n / 2;
	int x = 0;
	int y = 0;
	int mid = n / 2;
	int num = 1;
	int off = 1;
	while (ret--)
	{
		int i = x;
		int j = y;
		for (j = y; j < n - off; j++)
		{
			arr[x][j] = num++;
		}
		for (i = x; i < n - off; i++)
		{
			arr[i][j] = num++;
		}
		for (; j > y; j--)
		{
			arr[i][j] = num++;
		}
		for (; i > x; i--)
		{
			arr[i][j] = num++;
		}
		if (n % 2)
		{
			arr[mid][mid] = num;
		}
		for (i = 0; i < n; i++)
		{
			for (j = 0; j < n; j++)
			{
				printf("%d ", arr[i][j]);
			}
			printf("\n");
		}
	}
	return 0;
}